package com.example.demo.tools;



import java.util.HashMap;

public class Msg {
    private HashMap map;
    private int   code;
    private String message;

    public static Msg success(){
        HashMap<String , Object> HashMap = new HashMap<>();
        Msg msg = new Msg(HashMap, 200, "请求成功！");
        return msg;
    }

    public static Msg fail(){
        HashMap<String , Object> HashMap = new HashMap<>();
        Msg msg = new Msg(HashMap, 500, "请求失败！");
        return msg;
    }

    public void putObject(String key, Object object){
        this.map.put(key, object);
    }

    public Msg() {
    }
    public Msg(HashMap map, int code, String message) {
        this.map = map;
        this.code = code;
        this.message = message;
    }

    public HashMap getMap() {
        return map;
    }

    public void setMap(HashMap map) {
        this.map = map;
    }

    public int  getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
